package robot

import (
	"context"
	"fmt"
	"github.com/google/wire"
	"path"
	"runtime"
)

var ProviderSet = wire.NewSet(NewDingRobot)

type IRobot interface {
	SendMarkdownMessage(ctx context.Context, title string, msg string) error
}

func getCallerInfo(skip int) string {
	_, file, line, ok := runtime.Caller(skip)
	if !ok {
		fmt.Println("Caller failed")
		return ""
	}
	//funcName := runtime.FuncForPC(pc).Name()
	fileName := path.Join(path.Dir(file), path.Base(file))
	return fmt.Sprintf("%s:%d", fileName, line)
}
